package com.shrct.businessprocess.product.impl;

import com.shrct.businessprocess.product.RCAnonymousProductPurchaseInfo;
import com.shrct.businessprocess.product.RCAnonymouseProductEntryRoot;
import com.shrct.businessprocess.product.impl.RCAnonymouseProductEntryRootImpl;
import com.shrct.businessprocess.product.impl.RCProductPurchaseInfoImpl;
import com.shrct.businessprocess.product.proxy.RCAnonymousProductPurchaseInfoProxy;
import edu.fudan.mylang.pf.IObjectFactory;
import javax.persistence.CascadeType;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;

@Entity
@DiscriminatorValue("RCANONYMOUSPRODUCTPURCHASEINFO_TYPE")
public class RCAnonymousProductPurchaseInfoImpl extends RCProductPurchaseInfoImpl implements RCAnonymousProductPurchaseInfo {
  public RCAnonymousProductPurchaseInfoImpl() {
    super();
  }
  
  public RCAnonymousProductPurchaseInfoImpl(final RCAnonymouseProductEntryRoot entryRoot) {
    super();
    this.entryRoot = entryRoot;
  }
  
  @JoinColumn(name = "entryRoot_id")
  @ManyToOne(targetEntity = RCAnonymouseProductEntryRootImpl.class, cascade = { CascadeType.MERGE, CascadeType.PERSIST })
  private RCAnonymouseProductEntryRoot entryRoot;
  
  public RCAnonymouseProductEntryRoot getEntryRoot() {
    return this.entryRoot;
  }
  
  public RCAnonymousProductPurchaseInfo setEntryRoot(final RCAnonymouseProductEntryRoot entryRoot) {
    this.entryRoot = entryRoot;
    return this;			
    
  }
  
  public String getProductDesc() {
    return null;
  }
  
  public static RCAnonymousProductPurchaseInfo create(final RCAnonymouseProductEntryRoot entryRoot, final IObjectFactory objectFactory) {
    com.shrct.businessprocess.product.RCAnonymousProductPurchaseInfo rCAnonymousProductPurchaseInfo = new com.shrct.businessprocess.product.impl.RCAnonymousProductPurchaseInfoImpl(
    	entryRoot
    );
    objectFactory.create(rCAnonymousProductPurchaseInfo);
    return rCAnonymousProductPurchaseInfo;			
    
  }
  
  public static RCAnonymousProductPurchaseInfo createRCAnonymousProductPurchaseInfoImpl(final RCAnonymouseProductEntryRoot entryRoot, final IObjectFactory objectFactory, final Procedure1<RCAnonymousProductPurchaseInfo> init) {
    com.shrct.businessprocess.product.RCAnonymousProductPurchaseInfo rCAnonymousProductPurchaseInfo = new com.shrct.businessprocess.product.impl.RCAnonymousProductPurchaseInfoImpl(
    	entryRoot
    );
    objectFactory.create(rCAnonymousProductPurchaseInfo);
    init.apply(rCAnonymousProductPurchaseInfo);
    
    return rCAnonymousProductPurchaseInfo;			
    
  }
  
  public RCAnonymousProductPurchaseInfoProxy toProxy() {
    com.shrct.businessprocess.product.proxy.RCAnonymousProductPurchaseInfoProxy proxy = new com.shrct.businessprocess.product.proxy.RCAnonymousProductPurchaseInfoProxy();
    proxy.setId(this.getId());
    if(this instanceof edu.fudan.mylang.pf.INamedModelObject){
    	proxy.setName(((edu.fudan.mylang.pf.INamedModelObject)this).getEntityName());
    }
    return proxy;
    
  }
}
